package thread.java20221201;

/**
 * interrupted & isInterrupted 区别
 */
public class Demo14 {
    public static void main(String[] args) {
        Thread thread = Thread.currentThread();//当前线程
        System.out.println(thread.getName());

        thread.interrupt();
//        System.out.println(Thread.interrupted());//true
//        System.out.println(Thread.interrupted());//false
//        System.out.println(Thread.interrupted());//false
//        System.out.println(Thread.interrupted());//false

        System.out.println(thread.isInterrupted());//true
        System.out.println(thread.isInterrupted());//true
        System.out.println(thread.isInterrupted());//true
        System.out.println(thread.isInterrupted());//true
    }
}
